<?
define('SUPER_ADMIN',1);
define('ADMIN',2);
define('SUPERVISOR',3);

$centre_type=Array("","Center","Geeta Paathshala","None");
$sub_from_status=Array(0=>"",1=>"BK Centre",2=>"BK Member");
$seva_req_status=Array(0=>"New",1=>"Accepted",2=>"On Hold");
$prg_status=Array("Open","Accepted","Declined");
$prg_final_status=Array("Open","Confirmed","On Hold","Cancelled");
$seva_location=Array(0=>"Madhuban",1=>"Remote");
$log_types=Array(0=>"Member",1=>"Admin");
$class_status=Array("","Daily","Alternate","Twice a week","Once a week","Once a month","Rare");
$voip_status=Array("Submitted","Pending","Approval","Rejected","Deployed");
$voip_model=Array("","Grandstrem 286","Grandstream 486","Grandstream 502T","Linksys PAP2");
$voip_company=Array("","BSNL","Airtel","MTNL","Other");

$project_types=Array("","Web Application","Windows Application","Hardware & Networking","Maintenance");

$project_category=Array("","PMO","IT Infrastructure","Project Collaboration tools","Helpdesk","Website Frontend","App dev & web scripts","Multimedia","IT industry service","Information Research");

$query_types=Array("","Feedback","Suggestion","Query","Complaint","Invite Friend","Online Skype Raj Yoga Meditation","Other Information");

$education=Array(""=>"","B.E."=>"B.E.", "B.Tech."=>"B.Tech.", "M.E."=>"M.E.", "M.Tech."=>"M.Tech.", "B.C.A."=>"B.C.A.", "M.C.A"=>"M.C.A","Other"=>"Other");

$tech_spl=Array(""=>"",
"Hardware"=>"Hardware",
"Software"=>"Software",
"Networking"=>"Networking",
"Database"=>"Database",
"Communications"=>"Communications",
"Electronics"=>"Electronics",
"Animation"=>"Animation",
"Web Design"=>"Web Design",
"Web Development"=>"Web Development",
"Other"=>"Other");

$countries=Array(""=>"",

"BG"=>"Bangladesh",
"NP"=>"Nepal",
"SL"=>"Sri Lanka",
//"AR"=>"Argentina",
//"AU"=>"Australia",
//"AT"=>"Austria",
//"BE"=>"Belgium",
//"BR"=>"Brazil",
//"CA"=>"Canada",
//"CL"=>"Chile",
//"CN"=>"China",
//"CR"=>"Costa Rica",
//"CY"=>"Cyprus",
//"CZ"=>"Czech Republic",
//"DK"=>"Denmark",
//"DO"=>"Dominican Republic",
//"EC"=>"Ecuador",
//"EE"=>"Estonia",
///"FI"=>"Finland",
///"FR"=>"France",
//"DE"=>"Germany",
///"DE"=>"Germany",
///"GR"=>"Greece",
//"HK"=>"Hong Kong",
//"HU"=>"Hungary",
//"IS"=>"Iceland",
"IN"=>"India",
//"IE"=>"Ireland",
///"IL"=>"Israel",
///"IT"=>"Italy",
///"JM"=>"Jamaica",
//"JP"=>"Japan",
//"LV"=>"Latvia",
//"LT"=>"Lithuania",
//"LU"=>"Luxembourg",
//"MY"=>"Malaysia",
//"MT"=>"Malta",
//"MX"=>"Mexico",
//"NL"=>"Netherlands",
//"NZ"=>"New Zealand",
//"NO"=>"Norway",
//"PL"=>"Poland",
//"PT"=>"Portugal",
//"SG"=>"Singapore",
//"SK"=>"Slovakia",
//"SI"=>"Slovenia",
//"ZA"=>"South Africa",
//"KR"=>"South Korea",
//"ES"=>"Spain",
//"SE"=>"Sweden",
//"CH"=>"Switzerland",
//"TW"=>"Taiwan",
//"TH"=>"Thailand",
//"TR"=>"Turkey",
"UK"=>"United Kingdom",
//"GB"=>"United Kingdom",
//"US"=>"United States",
"US"=>"United States",
//"UY"=>"Uruguay",
//"VE"=>"Venezuela",
"Other"=>"Other"
);

$states=Array(
""=>"",
"Andaman and Nicobar Islands"=>"Andaman and Nicobar Islands",
"Andhra Pradesh"=>"Andhra Pradesh",
"Arunachal Pradesh"=>"Arunachal Pradesh",
"Assam"=>"Assam",
"Bihar"=>"Bihar",
"Chandigarh"=>"Chandigarh",
"Chhattisgarh"=>"Chhattisgarh",
"Dadra and Nagar Haveli"=>"Dadra and Nagar Haveli",
"Daman and Diu"=>"Daman and Diu",
"Delhi "=>"Delhi ",
"Goa"=>"Goa",
"Gujarat"=>"Gujarat",
"Haryana"=>"Haryana",
"Himachal Pradesh"=>"Himachal Pradesh",
"Jammu and Kashmir"=>"Jammu and Kashmir",
"Jharkhand"=>"Jharkhand",
"Karnataka"=>"Karnataka",
"Kerala"=>"Kerala",
"Lakshadweep"=>"Lakshadweep",
"Madhya Pradesh"=>"Madhya Pradesh",
"Maharashtra"=>"Maharashtra",
"Manipur"=>"Manipur",
"Meghalaya"=>"Meghalaya",
"Mizoram"=>"Mizoram",
"Nagaland"=>"Nagaland",
"Orissa"=>"Orissa",
"Puducherry"=>"Puducherry",
"Punjab"=>"Punjab",
"Rajasthan"=>"Rajasthan",
"Sikkim"=>"Sikkim",
"Tamil Nadu"=>"Tamil Nadu",
"Tripura"=>"Tripura",
"Uttar Pradesh"=>"Uttar Pradesh",
"Uttarakhand"=>"Uttarakhand",
"West Bengal"=>"West Bengal",
"Other"=>"Other"

);

 $sig_groups=Array("","PMO","IT Infrastructure","Project Collaboration tools","Helpdesk","Website Frontend","App dev & web scripts","Multimedia","IT industry service","Information Research");


    function createSelect($name, $arr_values,$selected = "", $additionals = "") {
        $str_content = "<select id='" . $name . "' name='" . $name . "' size='1' " . $additionals . " class='selectbox'>";
        if (is_array($arr_values)) {
            foreach ($arr_values as $key=>$arr_value) {
                $str_content .= "<option value='" . $key . "'" . ($key == $selected ? " SELECTED" : "") . ">" . $arr_value . "</option>";
            }
        }
        $str_content .= "</select>";

        return $str_content;
    }


function send_voip_acknowledge($toEmailId,$arr_data){

	
	$vMsg="Dear ".$arr_data["req_name"].", <br/> Your request for VoIP has been received. Processing the request will take a week or two.<br/> You will be notified once the request has been processed successfully. <br/><br/> Yours<br/> IT & Communication System. <br /><br /> <small><i>Note : This is a autogenerated email. Please don't reply to this email.</i></small>";
	
	$headers  = "MIME-Version: 1.0\r\n";
	$headers .= "Content-type: text/html; charset=iso-8859-1\r\n";
	$headers .='From:"Brahma Kumaris IT & Communications" <itncomm@bkconnect.net> '."\r\n";
	$headers .="Cc:yash108@gmail.com,itncomm@bkconnect.net,g_dileep@yahoo.com\r\n";
	$vmsg=str_replace("\n","<br>",$vmsg);
	$body="<table cellpadding='7' width='100%' cellspacing='0' border='0' bordercolor='#000000' align='center' style='border:1px;'>";
	$body.="<tr><td>";
	$body.="<font face=Arial size=-1><b></b></font><font face=Arial size=-1>".$vMsg."</font><br><br>";
	$body.="</td></tr></table>";
	
	$subject="Brahma Kumaris : IT & Communications : VoIP Request Acknowledgement. ";

	if (mail($toEmailId, $subject, $body,$headers)) {
	
	 } else {
	
	
	 }

}

function generateContentFromTpl($tplName,$params){

$file = file_get_contents("mail_tpl/".$tplName, true);
$contents=$file;
foreach($params as $key=>$value){

$contents=str_replace("#".$key."#",$value,$contents);

}

return $contents;
}


function reg_success($memberInfo)
{

$headers  = "MIME-Version: 1.0\r\n";
$headers.= "Content-type: text/html; charset=iso-8859-1\r\n";
$headers.='From:"Brahma Kumaris IT & Communications" <itncomm@bkconnect.net> '."\r\n";
$headers.="Bcc: itncomm@bkconnect.net,bksdeepak@gmail.com,searchnirmal100@yahoo.co.in\r\n";
$subject="BK India IT & Communications Retreat - Registration Success";

$params["MEMNAME"]=$memberInfo["full_name"];
$params["LBLBK"]="";
$params["LBLBKNAME"]="";

if($memberInfo["center_incharge_name"]!=""){
$params["LBLBK"]=" and <b>Raj Yogi BK</b> ";
$params["LBLBKNAME"]=$memberInfo["center_incharge_name"];
}
if($memberInfo["registrant_id"]!="")
	$params["USERNAME"]=formatMemberCode($memberInfo["registrant_id"]);
else
	$params["USERNAME"]="Please check with Admin or register again.";
	
$params["PASSWORD"]=$memberInfo["reg_password"];

$toEmailId=$memberInfo["email_id"];
$body=generateContentFromTpl("retreat_register.html",$params);

if (@mail($toEmailId, $subject, $body,$headers)) {
	return true;
 } else {

	return false;
 }



}
function notify_login_new($memberInfo,$vmode=1)
{

$headers  = "MIME-Version: 1.0\r\n";
$headers .= "Content-type: text/html; charset=iso-8859-1\r\n";
$headers .='From:"Brahma Kumaris IT & Communications" <itncomm@bkconnect.net> '."\r\n";
$headers .="Bcc: itncomm@bkconnect.net,bksdeepak@gmail.com,searchnirmal100@yahoo.co.in\r\n";
$subject="BK IT & Communications Account";

$params["MEMNAME"]=$memberInfo["full_name"];
$params["LBLBK"]="";
$params["LBLBKNAME"]="";

if($memberInfo["center_incharge_name"]!=""){
$params["LBLBK"]=" and <b>Raj Yogi BK</b> ";
$params["LBLBKNAME"]=$memberInfo["center_incharge_name"];
}
$params["USERNAME"]=formatMemberCode($memberInfo["registrant_id"]);
$params["PASSWORD"]=$memberInfo["reg_password"];

$toEmailId=$memberInfo["email_id"];
$body=generateContentFromTpl("notify_login.html",$params);

//$toEmailId="nirmal.kumar@bkconnect.net";
if (@mail($toEmailId, $subject, $body,$headers)) {
	return true;
 } else {

	return false;
 }


}



function submit_query($memberInfo)
{

$headers  = "MIME-Version: 1.0\r\n";
$headers .= "Content-type: text/html; charset=iso-8859-1\r\n";
$headers .='From:"Brahma Kumaris IT & Communications" <itncomm@bkconnect.net> '."\r\n";
$headers .="Bcc:bksdeepak@gmail.com,searchnirmal100@yahoo.co.in\r\n";


$params["MEMNAME"]=$memberInfo["full_name"];
$params["USERNAME"]=formatMemberCode($memberInfo["registrant_id"]);
$params["EMAILID"]=$memberInfo["email_id"];
$params["SKYPEID"]=$memberInfo["reg_chat_id"];
$params["MOBILENO"]=$memberInfo["mobile_no"];

$subject="BK: IT & Communications : Information from Member ".$params["MEMNAME"];

$body=generateContentFromTpl("feedback_admin.html",$params);

$toEmailId="itncomm@bkconnect.net";
if (@mail($toEmailId, $subject, $body,$headers)) {
	return true;
 } else {

	return false;
 }



}



function notify_login($toEmailId,$memberId,$password,$mode=0)
{


	if($mode==0) 
		$vMsg="Dear Brother/Sister, <br/><br/> The following is the login information to view your Member information in Brahma Kumaris : IT & Communications";
	else
		$vMsg="Dear Brother/Sister, <br/><br/> The following is the login information which you requested.";

	if($mode==0) 
		$vMsg .="<br/><br/><b>Account Information :</b>";
	else
		$vMsg .="<br/><br/><b>Forgot Password  :</b>";
	$vMsg .="<br/>Username : ".formatMemberCode($memberId)."</br>";
	$vMsg .=" Password : ".$password."</br>";

	$vMsg .=$footer;
	$headers  = "MIME-Version: 1.0\r\n";
	$headers .= "Content-type: text/html; charset=iso-8859-1\r\n";
	$headers .='From:"Brahma Kumaris IT & Communications" <itncomm@bkconnect.net> '."\r\n";
	
	if($mode==0) $headers .="Cc: itncomm@bkconnect.net,bksastry@gmail.com,bksdeepak@gmail.com\r\n";


	if($mode==0){
	$vMsg=$vMsg."<br/>After you login at above website: 
		<br/>
		<p>- Click on \"<a href=\"profile.php\">Profile</a>\" on left-hand side to update your personal information such as  - latest email, phone number, skill set, address, center address, login password, etc.</p>
		<p>-Click on \"<a href=\"sevaregister.php\">Sevadhari Registration Info</a>\" to fill-in sevadhari info & then click on \"<a href=\"sevaapplist.php\">Sevadhari Applications</a>\" to submit sevadhari request(s).</p>
		<p>- Feel free to contact below email address for more info or for further questions <a href=\"mailto:itncomm@bkconnect.net\">itncomm@bkconnect.net</a></p>
		
		<br/>
		With regards & best wishes,<br/>
		IT & Communications,<br/>
		Brahma Kumaris.<br/><br/>
		<a href='http://www.brahmakumaris.com'>www.brahmakumaris.com</a><br/>
		<a href='http://www.bkwsu.org'>www.bkwsu.org</a><br/>
		";
	
	
	}else{
	$vMsg=$vMsg."<br/>Thanks for contacting Brahma Kumaris, IT & Communications.
		<br/><br/>
		1. Kindly save this registration ID and confirmation email<br/>
		2. In future, kindly write mail to itncomm@bkconnect.net for any queries/suggestions<br/>
		3. Visit or be in touch with web portal <a href='http://it.brahmakumaris.com'>http://it.brahmakumaris.com</a> for latest developments<br/>
		4. Please spread the message by sharing  following websites:<br/><br/>
		<a href='http://www.brahmakumaris.com'>www.brahmakumaris.com</a><br/>
		<a href='http://www.bkwsu.org'>www.bkwsu.org</a><br/>
		<br/>
		With regards & best wishes,<br/>
		IT & Communications,<br/>
	Brahma Kumaris.<br/>";
	}
	
	
	$body="<table cellpadding='7' width='100%' cellspacing='0' border='0' bordercolor='#000000' align='center' style='border:1px;'>";
	$body.="<tr><td>";
	$body.="<font face=Arial size=-1><b></b></font><font face=Arial size=-1>".$vMsg."</font><br><br>";
	$body.="</td></tr></table>";
	
	
	$subject="Account Information";

	if (@mail($toEmailId, $subject, $body,$headers)) {
		return true;
	 } else {
	
		return false;
	 }

}






function send_member_email($toEmailId,$memberId,$password="",$vMode=1)
{


$memberInfo = @array_pop(qry_data("select distinct registrant_id,full_name,email_id,reg_password,center_incharge_name  from bkitc_profiles where rec_status=1 and registrant_id in ($memberId) and email_id!=''"));
//echo "<pre>";
//print_r($memberInfo);
//echo "</pre>";
notify_login_new($memberInfo,$vMode);
return true;
	/*if($password=="") $password=generatePassword(formatMemberCode($memberId));
	$vMsg="Dear Brother/Sister, <br/> Thank you for registration to BK ITC & here is your registration ID : BKITC".$memberId;

	$vMsg .="<br/><br/><b>Account Information :</b>";
	$vMsg .="<br/>Username : ".formatMemberCode($memberId)."</br>";
	$vMsg .=" Password : ".$password."</br>";

	$vMsg .=$footer;

	$headers  = "MIME-Version: 1.0\r\n";
	$headers .= "Content-type: text/html; charset=iso-8859-1\r\n";
	$headers .='From:"Brahma Kumaris IT & Communications" <itncomm@bkconnect.net> '."\r\n";
	$headers .="Cc: itncomm@bkconnect.net,bksastry@gmail.com,bksdeepak@gmail.com\r\n";
	
	$vMsg=$vMsg."<br/>Thanks for contacting Brahma Kumaris, IT & Communications.
		<br/><br/>
		1. Kindly save this registration ID and confirmation email<br/>
		2. In future, kindly write mail to itncomm@bkconnect.net for any queries/suggestions<br/>
		3. Visit or be in touch with web portal <a href='http://it.brahmakumaris.com'>http://it.brahmakumaris.com</a> for latest developments<br/>
		4. Please spread the message by sharing  following websites:<br/><br/>
		<a href='http://www.brahmakumaris.com'>www.brahmakumaris.com</a><br/>
		<a href='http://www.bkwsu.org'>www.bkwsu.org</a><br/>
		<br/>
		With regards & best wishes,<br/>
		IT & Communications,<br/>
	Brahma Kumaris.<br/>";
		
	$body="<table cellpadding='7' width='100%' cellspacing='0' border='0' bordercolor='#000000' align='center' style='border:1px;'>";
	$body.="<tr><td>";
	$body.="<font face=Arial size=-1><b></b></font><font face=Arial size=-1>".$vMsg."</font><br><br>";
	$body.="</td></tr></table>";
	
	
	$subject="Brahma Kumaris : IT & Communications : Registration Confirmation";

	if (mail($toEmailId, $subject, $body,$headers)) {
	 $msgStatus="<p>Message successfully sent!</p>";
	 } else {
	
	   $msgStatus="<p>Message delivery failed...</p>";
	 }
	 
	*/
	 

}


function send_voip_notify($arr_data){

	$info="Name : ".$arr_data["req_name"];
	$info.="<br/>Email : ".$arr_data["req_email_id"];
	$info.="<br/>Centre Address : ".$arr_data["req_centre_address"];
	$info.="<br/>Phone No : ".$arr_data["req_phone_no"];

	$vMsg="Dear Administrator, <br/>A new VoIP request has been submitted. Please review the following.<br/> <br/>  $info <br/><br/> For more info, visit the admin panel. <br/><br/> Yours<br/> IT & Communication System. <br /><br /> <small><i>Note : This is a autogenerated email. Please don't reply to this email.</i></small>";
	
	$headers  = "MIME-Version: 1.0\r\n";
	$headers .= "Content-type: text/html; charset=iso-8859-1\r\n";
	$headers .='From:"Brahma Kumaris IT & Communications" <itncomm@bkconnect.net> '."\r\n";
	$headers .="Cc:itncomm@bkconnect.net,g_dileep@yahoo.com\r\n";
	$vmsg=str_replace("\n","<br>",$vmsg);
	$body="<table cellpadding='7' width='100%' cellspacing='0' border='0' bordercolor='#000000' align='center' style='border:1px;'>";
	$body.="<tr><td>";
	$body.="<font face=Arial size=-1><b></b></font><font face=Arial size=-1>".$vMsg."</font><br><br>";
	$body.="</td></tr></table>";
	
	$subject="Brahma Kumaris : IT & Communications : New VoIP Request. ";

	if (mail("yash108@gmail.com", $subject, $body,$headers)) {
	
	 } else {
	
	
	 }
	

}

function generatePassword($memberCode){
	return substr(md5($memberCode),0,5);

}


function number_pad($number,$n) {
return str_pad((int) $number,$n,"0",STR_PAD_LEFT);
}

function formatMemberCode($memberId) {
return "BKITC".number_pad($memberId,5);
}

function getIndianDateTime()
{

$timeNdate=date('Y-m-d H:i:s', time() + 37800);

return $timeNdate;

}


function checkRole($roleType){

$_SESSION["role_type"]=(int)$_SESSION["role_type"];
if($_SESSION["role_type"]==0) $_SESSION["role_type"]=3;
if($_SESSION["role_type"]==$roleType) return true;
return false;

}

function getRoleTitle(){

$roleType=$_SESSION["role_type"];
$roleNames=Array("","IT Administrator","IT Admin","IT Supervisor");
return $roleNames[$roleType];
}


function feedback_thank($toEmailId){

	 $vMsg="Thanks for contacting Brahma Kumaris, IT & Communications.
	<br/><br/>
	1. In future, kindly write mail to itncomm@bkconnect.net for any queries/suggestions<br/><br/>
	2. Visit or be in touch with web portal <a href='http://it.brahmakumaris.com'>http://it.brahmakumaris.com</a> for latest developments<br/><br/>
	3. Please spread the message by sharing  following websites:<br/><br/>
	<a href='http://www.brahmakumaris.com'>www.brahmakumaris.com</a><br/>
	<a href='http://www.bkwsu.org'>www.bkwsu.org</a><br/>
	<br/>
	With regards & best wishes,<br/>
	IT & Communications,<br/>
	Brahma Kumaris.<br/>";
	
	$headers  = "MIME-Version: 1.0\r\n";
	$headers .= "Content-type: text/html; charset=iso-8859-1\r\n";
	$headers .='From:"Brahma Kumaris IT & Communications" <itncomm@bkconnect.net> '."\r\n";
	
		
	$body="<table cellpadding='7' width='100%' cellspacing='0' border='0' bordercolor='#000000' align='center' style='border:1px;'>";
	$body.="<tr><td>";
	$body.="<font face=Arial size=-1><b></b></font><font face=Arial size=-1>".$vMsg."</font><br><br>";
	$body.="</td></tr></table>";
	
	
	$subject="Brahma Kumaris : IT & Communications : Feedback Received";

	if (mail($toEmailId, $subject, $body,$headers)) {
	 $msgStatus="<p>Message successfully sent!</p>";
	 } else {
	
	   $msgStatus="<p>Message delivery failed...</p>";
	 }


}

function sendLoginRequest($memberName,$emailId){

$arr_info= qry_data("select * from bkitc_profiles where email_id='".$emailId."'"); 
$member_count=count($arr_info);


if($member_count==1){
	$arr_info=@array_pop($arr_info);
	$pwd=$arr_info["reg_password"];
	$memberId=$arr_info["registrant_id"];
	
	if(notify_login_new($arr_info))
		return 1;
	else 
		return 4;
}
else if($member_count>1){

	$info="Name : ".$memberName;
	$info.="<br/>Email : ".$emailId;
	$vMsg="Dear Administrator, <br/>A Member has requested Login details with  the following basic information. Please review the following.<br/> <br/>  $info <br/>";
	
	$headers  = "MIME-Version: 1.0\r\n";
	$headers .= "Content-type: text/html; charset=iso-8859-1\r\n";
	$headers .='From:"Brahma Kumaris IT & Communications" <itncomm@bkconnect.net> '."\r\n";
	
	$vmsg=str_replace("\n","<br>",$vmsg);
	$body="<table cellpadding='7' width='100%' cellspacing='0' border='0' bordercolor='#000000' align='center' style='border:1px;'>";
	$body.="<tr><td>";
	$body.="<font face=Arial size=-1><b></b></font><font face=Arial size=-1>".$vMsg."</font><br><br>";
	$body.="</td></tr></table>";
	
	$subject="Brahma Kumaris : IT & Communications : Login Info request from Member ".$memberName;
	$to ="itncomm@bkconnect.net,bksanjivgupta@gmail.com";
	mail($to,  $subject, $body,$headers);

}else{

	return 3;
	
}


		
}

function notifySevareqStatus($arr_data){

	$memberName=$arr_data["full_name"];
	$emailId=$arr_data["email_id"];
	
	$info.="<br/>Notes from Admin : ".$arr_data["email_info"];
	
	$vMsg="Dear $memberName, <br/>Status of your request for Sevadhari<br/>".$info;
	
	$headers  = "MIME-Version: 1.0\r\n";
	$headers .= "Content-type: text/html; charset=iso-8859-1\r\n";
	$headers .='From:"Brahma Kumaris IT & Communications" <itncomm@bkconnect.net> '."\r\n";
	
	$vmsg=str_replace("\n","<br>",$vmsg);
	$body="<table cellpadding='7' width='100%' cellspacing='0' border='0' bordercolor='#000000' align='center' style='border:1px;'>";
	$body.="<tr><td>";
	$body.="<font face=Arial size=-1><b></b></font><font face=Arial size=-1>".$vMsg."</font><br><br>";
	$body.="</td></tr></table>";
	
	$subject="Brahma Kumaris : IT & Communications : Status of your request for Sevadhari";
	$to =$emailId;
	mail($to, $subject, $body,$headers);


}

function send_avsubscribe_notify($arr_data){


	$memberName=$arr_data["contact_name"];
	$emailId=$arr_data["contact_email"];
	
	$notes=$arr_data["user_notes"];
	$phone=$arr_data["contact_mobile"];	

	$info.="<br/><br/>Here Some Information : <br/><br/>Name : ".$memberName;
	
	
	if($emailId==""){
	
	$info.="<br/>BKITC Member Reg Id :  ".$arr_data["contact_reg_id"]."";
	$info.="<br/>Contact Name  : ".$arr_data["contact_name"]."";
	$info.="<br/>Contact Email : ".$arr_data["contact_email"]."";
	
	}else{
	
	$emailId=$arr_data["centre_email"];
	$info.="<br/>Centre Name :  ".$arr_data["centre_name"]."";
	$info.="<br/>Centre Reg Id :  ".$arr_data["centre_reg_id"]."";
	$info.="<br/>Contact Name  : ".$arr_data["contact_name"]."";
	$info.="<br/>Contact Email : ".$arr_data["centre_email"]."";
	
	
	}
	
	$info.="<br/>Mobile No : ".$phone."";
	$info.="<br/>No.of Licenses : ".$arr_data["sub_count"]."";
	$info.="<br/>Pay Date : ".$arr_data["pay_date"]."";
	$info.="<br/>Pay Remarks : ".$arr_data["pay_remarks"]."";
	$info.="<br/>Amout Paid : ".$arr_data["amount"]."";
	$info.="<br/>Notes/Suggestions : ".$notes."<br/><br/>";
	
	
	$info.="
	With regards & best wishes,<br/>
	IT & Communications,<br/>
	Brahma Kumaris.<br/>";
	
	$vMsg="Dear Administrator, <br/>$memberName Registered for the AntiVirus Subscription : ".$info."<br/>";
	
	$headers  = "MIME-Version: 1.0\r\n";
	$headers .= "Content-type: text/html; charset=iso-8859-1\r\n";
	$headers .='From:"Brahma Kumaris IT & Communications" <itncomm@bkconnect.net> '."\r\n";
	$headers .="Bcc:searchnirmal100@yahoo.co.in\r\n";
	

	$vMsg=str_replace("\n","<br>",$vMsg);
	$body="<table cellpadding='7' width='100%' cellspacing='0' border='0' bordercolor='#000000' align='center' style='border:1px;'>";
	$body.="<tr><td>";
	$body.="<font face=Arial size=-1><b></b></font><font face=Arial size=-1>".$vMsg."</font><br><br>";
	$body.="</td></tr></table>";
	
	$subject="$memberName Registered for AntiVirus Subscription:";
	$to="procurement.in@bkconnect.net";
	
	$headers .="Cc:dilip@bkconnect.net\r\n";
	
	mail($to, $subject, $body,$headers);


}
function send_avsubscribe_notification($arr_data){


	$memberName=$arr_data["contact_name"];
	$emailId=$arr_data["contact_email"];
	if($emailId=="") $emailId=$arr_data["centre_email"];
	$notes=$arr_data["user_notes"];
	$phone=$arr_data["contact_mobile"];	

	$info.="<br/><br/>Here Some Information : <br/><br/>Name : ".$memberName;
	$info.="<br/>Email : ".$emailId."";
	$info.="<br/>Mobile No : ".$phone."";
	$info.="<br/>Notes/Suggestions : ".$notes."<br/><br/>";
	
	$info.="
	With regards & best wishes,<br/>
	IT & Communications,<br/>
	Brahma Kumaris.<br/>";
	
	$vMsg="Dear Administrator, <br/>$memberName Registered for the AntiVirus Subscription : ".$info."<br/> For more details login to Admin Panel<br/>";
	
	$headers  = "MIME-Version: 1.0\r\n";
	$headers .= "Content-type: text/html; charset=iso-8859-1\r\n";
	$headers .='From:"Brahma Kumaris IT & Communications" <itncomm@bkconnect.net> '."\r\n";
	$headers .="Bcc:searchnirmal100@yahoo.co.in\r\n";
	

	$vMsg=str_replace("\n","<br>",$vMsg);
	$body="<table cellpadding='7' width='100%' cellspacing='0' border='0' bordercolor='#000000' align='center' style='border:1px;'>";
	$body.="<tr><td>";
	$body.="<font face=Arial size=-1><b></b></font><font face=Arial size=-1>".$vMsg."</font><br><br>";
	$body.="</td></tr></table>";
	
	$subject="$memberName Registered for AntiVirus Subscription:";
	$to="pmo.in@bkconnect.net";
	
	$headers .="Cc:dilip@bkconnect.net,itncomm@bkconnect.net\r\n";
	
	mail($to, $subject, $body,$headers);


}
function send_event_notification($arr_data){

	$memberName=$arr_data["full_name"];
	$emailId=$arr_data["reg_email"];
	$event_name=$arr_data["event_title"];	
	$notes=$arr_data["reg_notes"];	
	$phone=$arr_data["reg_mobile"];	

	$info.="<br/><br/>Here Some Information : <br/><br/>Name : ".$memberName;
	$info.="<br/>Email : ".$emailId."";
	$info.="<br/>Mobile No : ".$phone."";
	$info.="<br/>Notes/Suggestions : ".$notes."<br/>";
	
	$vMsg="Dear Administrator, <br/>$memberName Registered for the Event : ".$event_name.$info."<br/> For more details login to Admin Panel<br/>";
	
	$headers  = "MIME-Version: 1.0\r\n";
	$headers .= "Content-type: text/html; charset=iso-8859-1\r\n";
	$headers .='From:"Brahma Kumaris IT & Communications" <itncomm@bkconnect.net> '."\r\n";
	$headers .="Bcc:searchnirmal100@yahoo.co.in\r\n";
	
	
	$vmsg=str_replace("\n","<br>",$vmsg);
	$body="<table cellpadding='7' width='100%' cellspacing='0' border='0' bordercolor='#000000' align='center' style='border:1px;'>";
	$body.="<tr><td>";
	$body.="<font face=Arial size=-1><b></b></font><font face=Arial size=-1>".$vMsg."</font><br><br>";
	$body.="</td></tr></table>";
	
	$subject="$memberName Registered for the Event : ".$event_name;

	$toEmailId=$arr_data["event_admin_email"];
	
	if($toEmailId!="") {
		$to=$toEmailId;
		$headers .="Cc:itncomm@bkconnect.net\r\n";
		
	}
	else
		$to ="dilip@bkconnect.net";

	mail($to, $subject, $body,$headers);
	
}

function intimateSevaRequest($arr_data){

	$memberName=$arr_data["full_name"];
	$emailId=$arr_data["email_id"];
	$memberId=$arr_data["registrant_id"];
	$info.="<br/><br/>Member Id : ".formatMemberCode($memberId);
	$info.="<br/>Name : ".$memberName;
	$info.="<br/>Email : ".$emailId."<br/><br/>";
	$vMsg="Dear Administrator, <br/>A Member  applied for Sevadhari. $info For more details login to Admin Panel<br/>";
	
	$headers  = "MIME-Version: 1.0\r\n";
	$headers .= "Content-type: text/html; charset=iso-8859-1\r\n";
	$headers .='From:"Brahma Kumaris IT & Communications" <itncomm@bkconnect.net> '."\r\n";
	
	$vmsg=str_replace("\n","<br>",$vmsg);
	$body="<table cellpadding='7' width='100%' cellspacing='0' border='0' bordercolor='#000000' align='center' style='border:1px;'>";
	$body.="<tr><td>";
	$body.="<font face=Arial size=-1><b></b></font><font face=Arial size=-1>".$vMsg."</font><br><br>";
	$body.="</td></tr></table>";
	
	$subject="Brahma Kumaris : IT & Communications : Sevadhari request from Member ".$memberName;

	$to ="itncomm@bkconnect.net,dilip@bkconnect.net";
	mail($to, $subject, $body,$headers);
	
}

function sendPassword($memberShipId,$emailId){

$arr_info= @array_pop(qry_data("select * from bkitc_profiles where concat('BKITC',LPAD(registrant_id,5,'0'))='".$memberShipId."'")); 
$email=$arr_info["email_id"];
$pwd=$arr_info["reg_password"];
$memberId=$arr_info["registrant_id"];

	if(is_array($arr_info))
	{	
		if($email==$emailId){
			if(send_member_email($emailId,$memberId,$pwd,2))
				return 1;
			else 
				return 4;
			
		}
		else
			return 3;
	
	}else
	
		return 2;
	

}
function getMenuClass($menuId,$curmenu){

	if($menuId==$curmenu)
		return "class='active'";
	else 
		return "";
	
	


}




function ast(){

return "<span class='ast'>*</span>";
}

function writeLog($log_remarks,$log_content="",$user_type=0,$log_type=0){

$curTime=getIndianDateTime();
if($user_type==0) 
	$user_id=$_SESSION["member_id"];
else
	$user_id=$user_type;

$log_type=0;
if($log_content!="") $log_type=1;
$ip=$_SERVER['REMOTE_ADDR'];
$log_remarks=addslashes($log_remarks);
$query_insert_log="INSERT INTO bkitc_log(log_date,user_type,user_id,log_type,log_remarks,log_content,ip_address) ";
$query_insert_log.="VALUES('".$curTime."','".$user_type."','".$user_id."','".$log_type."','".$log_remarks."','".$log_content."','".$ip."')";

exec_qry($query_insert_log);

}

function compareLogData($v1,$v2)
{
if ($v1===$v2)
  {
  return 0;
  }
if ($v1>$v2)
  {
  return 1;
  }
else
  {
  return -1;
  }
}

function dateDifference($date1, $date2)
{
    $d1 = (is_string($date1) ? strtotime($date1) : $date1);
    $d2 = (is_string($date2) ? strtotime($date2) : $date2);



    $diff_secs = abs($d1 - $d2);
    $base_year = min(date("Y", $d1), date("Y", $d2));

    $diff = mktime(0, 0, $diff_secs, 1, 1, $base_year);

    return array
    (
        "years"                 => abs(substr(date('Ymd', $d1) - date('Ymd', $d2), 0, -4)),
       // "months_total"  => (date("Y", $diff) - $base_year) * 12 + date("n", $diff) - 1,
        "months"                => date("n", $diff) - 1,
      //  "days_total"    => floor($diff_secs / (3600 * 24)),
      //  "days"                  => date("j", $diff) - 1,
      //  "hours_total"   => floor($diff_secs / 3600),
      //  "hours"                 => date("G", $diff),
      //  "minutes_total" => floor($diff_secs / 60),
      //  "minutes"               => (int) date("i", $diff),
      //  "seconds_total" => $diff_secs,
      //  "seconds"               => (int) date("s", $diff)
    );
} 

function getValidDateFormat($datedmy){
list($d, $m, $y) = explode('-', $datedmy);
return $y."-".$m."-".$d;
}

?>